<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>供应商管理系统-{$webname}</title>
        {Common::css("style.css,base.css,extend.css,supplier_back.css")}
        {Common::js("jquery.min.js,common.js,choose.js")}
        <link type="text/css" href="/res/js/webuploader/webuploader.css" rel="stylesheet"  />
        <script type="text/javascript" src="/res/js/webuploader/webuploader.min.js"></script>
        <link type="text/css" href="/min/?f=/tools/js/artDialog/css/ui-dialog.css,/tools/js/msgbox/msgbox.css" rel="stylesheet" />
        <script type="text/javascript"src="/min/?f=/tools/js/artDialog/dist/dialog-plus.js,/tools/js/msgbox/msgbox.js"></script>
        <script>
            window.SITEURL="{$cmsurl}";
            window.BASEHOST="{$GLOBALS['cfg_basehost']}";
            window.PUBLICURL="{$GLOBALS['cfg_public_url']}";
        </script>
        <style>
            .select{
                box-sizing: border-box;
                cursor: pointer;
                height: 30px;
                line-height: normal;
                font-weight: normal;
                font-size: 12px;
                white-space: nowrap;
                border: 1px #d5e5d6 solid;
            }
            .btn-success{
                margin-top: -4px;
                width: 50px;
                height: 25px;
                background: #14cc5c;
                color: #fff;
                border-radius: 3px;
                font-size: 13px;
            }
        </style>
    </head>
    <body bottom_top=xWRX4t >
        <div class="supplier-main-block">
            <div class="content-box">
                <div class="frame-box">
                    <div class="frame-con">
                        <div class="account-box">
                            <div class="account-tit"><strong class="bt">梦旅程供销中台</strong></div>
                            <form id="usrfrm">
                                <div class="account-con">
                                    <ul>
                                        <li>
                                            <strong class="lm">partnerId：</strong>
                                            <div class="nr">
                                                <input type="text" class="msg-text" style="width: 300px" name="partner_id" value="{$config['partner_id']}"/>
                                            </div>
                                        </li>
                                        {if $ota_list}
                                        <li>
                                            <strong class="lm">渠道：</strong>
                                            <div class="nr">
                                                <select class="select w300">
                                                    <option value="0">请选择渠道</option>
                                                    {loop $ota_list $ota}
                                                    <option data-name="{$ota['ota_name']}" value="{$ota['import_url']}">{$ota['ota_name']}</option>
                                                    {/loop}
                                                </select>
                                                <input class="btn btn-success radius" onclick="import_product()" type="button" value="导入">
                                            </div>
                                        </li>
                                        {/if}
                                    </ul>
                                    <div class="account-save-box"><a href="javascript:;" onclick="ajax_sava_partner()" class="save_btn">保存</a></div>
                                </div>
                            </form>
                        </div><!-- 账户资料 -->
                    </div>
                </div>
            </div>
        </div>
        {Common::js("layer/layer.js")}
        <script>
            function import_product()
            {
                var ota_url = $('.select option:selected').val();
                var ota_name = $('.select option:selected').attr('data-name');
                if(ota_url != 0){
                    var params= {};
                    ST.Util.showBox(ota_name+'-导入',ota_url,900,530,null,null,document,params);
                }else{
                    layer.msg("请先选择渠道", {
                        icon: 5,
                        time: 1000
                    })
                }
            }
            function ajax_sava_partner()
            {
                var partner_id = $("[name='partner_id']").val();
                var url = '/supplier/pc/provider/ajax_sava_partner';
                $.ajax({
                    type: "post",
                    url: url,
                    dataType: 'json',
                    data: {partner_id:partner_id},
                    success: function (result){
                        layer.msg("{__('save_success')}", {
                            icon: 6,
                            time: 1000
                        })
                        setTimeout(function(){
                            window.location.reload()
                        },1000)
                    }
                });
            }
        </script>
    </body>
</html>
